Obtaining QR scan results via ZXing that is integrated into your app - android

I used this answer to create a standalone Android library project that has the ZXing source code in it (ZXing v2.1). It compiles fine and if I run CaptureActivity, I can read a QR code as expected.
I have another Android project from which I want to pull in this library. I have set that library relationship up correctly.
The issue I am having is, how do I launch my local copy of the ZXing scanner via IntentIntegrator (mentioned here).
I tried modifying the IntentIntegrator.initiateScan() method to use my local copy of CaptureActivity, and that loads the QR scanner properly. However, once the QR code is scanned the QR information is displayed on-screen instead of sending the result back to my calling activity in onActivityResult.
How can I make it send the QR scan results to onActivityResult of my calling activity?
For reference, here is what I changed the IntentIntegrator.initiateScan() method to:
public AlertDialog initiateScan(Activity act, Collection<String> desiredBarcodeFormats) {
//Hardcoding name of activity to call --> is this where I've gone wrong?
Intent intentScan = new Intent(act, CaptureActivity.class);
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// check which types of codes to scan for
if (desiredBarcodeFormats != null) {
// set the desired barcode types
StringBuilder joinedByComma = new StringBuilder();
for (String format : desiredBarcodeFormats) {
if (joinedByComma.length() > 0) {
joinedByComma.append(',');
}
joinedByComma.append(format);
}
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
}
//Commented this out because it didn't seem to find my class...
// String targetAppPackage = findTargetAppPackage(intentScan);
// if (targetAppPackage == null) {
// return showDownloadDialog();
// }
//
//
// intentScan.setPackage(targetAppPackage);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
attachMoreExtras(intentScan);
startActivityForResult(intentScan, REQUEST_CODE);
return null;
}
And I'm initiating the scan like this:
IntentIntegrator integrator = new IntentIntegrator(getActivity());
integrator.initiateScan(getActivity());
I feel like I'm missing something easy here, any push in the right direction would be great.
SOLUTION
Here's what ended up working. I still invoke it the same way with:
IntentIntegrator integrator = new IntentIntegrator(getActivity());
integrator.initiateScan(getActivity());
But the initiateScan method now looks like this:
public AlertDialog initiateScan(Activity act, Collection<String> desiredBarcodeFormats)
{
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// check which types of codes to scan for
if (desiredBarcodeFormats != null) {
// set the desired barcode types
StringBuilder joinedByComma = new StringBuilder();
for (String format : desiredBarcodeFormats) {
if (joinedByComma.length() > 0) {
joinedByComma.append(',');
}
joinedByComma.append(format);
}
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
}
//THIS WAS THE KEY
setSingleTargetApplication(act.getPackageName());
String targetAppPackage = findTargetAppPackage(intentScan);
if (targetAppPackage == null) {
return showDownloadDialog();
}
intentScan.setPackage(targetAppPackage);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
attachMoreExtras(intentScan);
act.startActivityForResult(intentScan, REQUEST_CODE);
return null;
}
Important things are make sure that BS_PACKAGE points to the CaptureActivity package, that you call "act.startActivityForResult..." instead of just "startActivityForResult..." and that you call setSingleTargetApplication with the package name of the application that will be calling the scanner.

Try to change the line startActivityForResult(intentScan, REQUEST_CODE);
to act.startActivityForResult(intentScan, REQUEST_CODE);
You do not need to comment the code that contains findTargetAppPackage, just set your target application's package by calling setSingleTargetApplication() (if you are the only application using this library)

Related

How can I attach an image to a "Direct Message" in twitter Android?

I programmed an app that can send a message to twitter with an image attached. It works! I tested it on several devices and asked other people to do the same. It even works for a Direct Message when a twitter friend is selected. However, it does not work when "Direct Message" is selected. This forces the user to select a friend directly instead of selecting him via "Direct Message" (which is really strange) otherwise the picture is not attached. Just have a look at the screenshot:
Here is my Xamarin Android programming code. Let me know how to fix it. Currently, all options work, even selecting my friend but not "Direct Message". I also need to tell that I do not have any issue with the twitter text I expect to see in the tweet.
public bool TweetImage(Bitmap imageToTweet)
{
var messageIntent = context.FindMessageIntent(this.twitterConstants.PackageName);
if (messageIntent == null)
{
return false;
}
string outputFileBMP = SaveBitmap(imageToTweet);
context.Tweet(messageIntent, outputFileBMP, this.twitterConstants.DefaultTwitterText, this.twitterConstants.ChooserMessage);
return true;
}
and
public static Intent FindMessageIntent(this ContextWrapper contextWrapper, params string[] packageNames)
{
Intent wantedIntent = new Intent();
wantedIntent.SetType("text/plain");
var resolveInfos = contextWrapper.PackageManager.QueryIntentActivities(wantedIntent, PackageInfoFlags.MatchDefaultOnly);
var result = (from r in resolveInfos
from p in packageNames
where p == r.ActivityInfo.PackageName
select p).FirstOrDefault();
if (result != null)
{
wantedIntent.SetPackage(result);
return wantedIntent;
}
return null;
}
and
public static void Tweet(this ContextWrapper contextWrapper, Intent messageIntent, string filePath = null, string message = null, string chooserMessage = null)
{
if (filePath != null)
{
using (var file = new Java.IO.File(filePath))
{
messageIntent.PutExtra(Intent.ExtraStream, Android.Net.Uri.FromFile(file));
}
}
if (message != null)
{
messageIntent.PutExtra(Intent.ExtraText, message);
}
if (chooserMessage != null)
{
using (var chooser = Intent.CreateChooser(messageIntent, chooserMessage))
{
contextWrapper.StartActivity(chooser);
}
return;
}
contextWrapper.StartActivity(messageIntent);
}
Please note that I am using Android and need a solution based on Android (intent based).
Sadly, Twitter don't provide API access for uploading images via DM.
If you are able to use Twitter's private API, you should be able to attach a media_id to your DM. But other than that, you're out of luck.
Sorry.

Document-picker keeps showing up even though persistence is set (in SAF - Storage Access Framework)

Using Android 6.0.1, API 23,
I successfully implemented reading a file from a storage-location that the user picks in the document-picker of SAF (Storage Access Framework).
Now, I would like to use the Persist permissions that SAF allows in order to allow my App to always pick the same file (but without any document-picker window [and sub-windows] popping in all the time).
I somehow succeeded in implementing the Persist-permissions (as shown in the SAF-doc) (...for that, see my code example below...) - But questions came up:
In spite of persistence-permission working - why does the document-picker window keep popping up? Once the file is picked by the user - from this moment on - I would like to simply get the file content without any picker window coming to foreground. Is this possible? And if yes, how?
(I can tell that persistence permission is somehow working since the file gets read immediately without the user having to pick again. But still this nasty picker window should not have to come up - or does it?)
Is it possible to keep SAF persistence-permission even if my App gets closed or stopped? If yes, how?
Here is the code sample that does get the file content, including my trial with the persistence permission:
Inside a StorageClientFragment Class:
public String locationFileContent;
public void performFileSearch() {
Intent openDocumentIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
openDocumentIntent.addCategory(Intent.CATEGORY_OPENABLE);
openDocumentIntent.setType("text/plain");
openDocumentIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
startActivityForResult(openDocumentIntent, READ_REQUEST_CODE);
}
#Override
public void onActivityResult(int requestCode, int resultCode, Intent resultData) {
if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
Uri uri = null;
if (resultData != null) {
uri = resultData.getData();
// Here is my Persist-permission trial !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
getActivity().getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
try {
this.locationFileContent = readTextFromUri(uri);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private String readTextFromUri(Uri uri) throws IOException {
InputStream inputStream = getActivity().getContentResolver().openInputStream(uri);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
stringBuilder.append(line);
}
inputStream.close();
return stringBuilder.toString();
}
Creating the Fragment gets done in MainActivity:
StorageClientFragment storageClientFragment;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getSupportFragmentManager().findFragmentByTag(FRAGTAG) == null ) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
storageClientFragment = new StorageClientFragment();
transaction.add(storageClientFragment, FRAGTAG);
transaction.commit();
}
}
Calling the FileSearch is done when a Test-Button is clicked:
public void TestingButtonClicked(View view) {
this.storageClientFragment.performFileSearch();
String stringFileContent = this.storageClientFragment.locationFileContent;
Toast.makeText(this, "Back in Main, Content = " + stringFileContent, Toast.LENGTH_SHORT).show();
}
The above code works nicely. But again, how can I stop the SAF document-picker window from showing up all the time (even though persist permission is set)?
why does the document-picker window keep croping up ?
Presumably because you keep starting an ACTION_OPEN_DOCUMENT activity. If you do not want to ask the user to pick a document, do not start this activity.
I would like to simply get the file content without any picker-window coming to foreground. Is this possible ? And if yes, how ??
The same way that you got the content originally: pass the Uri to openInputStream() on a ContentResolver.
If you are using takePersistableUriPermissions() to aim for long-lived access to the content, it is still your job to hold onto the Uri. This is not significantly different than how this sort of thing works in other environments (e.g., remembering the user's history of local file paths for a desktop OS program).
Since a Uri can be trivially converted to and from a String, saving the Uri somewhere (database, SharedPreferences, or other file) is not especially difficult.
Is it possible to keep SAF persistance-permission even if my App gets closed or stopped ? If yes, how ??
takePersistableUriPermission(), as you have already implemented.

Is it possible to exclude SIM contacts when using Intent.ACTION_PICK?

I need to pick contacts in my app and would like to exclude those which are stored in my SIM card. Is it possible with ACTION_PICK?
No, it's not possible
Unfortunately, it's not possible for now.
To proof it, let's dive into source code of ContanctsListActivity.
Here's an onCreate() method of the Activity. In it, ContactApp reads Intent(ACTION_PICK) we passing to it and handles it respectively:
#Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
mIconSize = getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
mContactsPrefs = new ContactsPreferences(this);
mPhotoLoader = new ContactPhotoLoader(this, R.drawable.ic_contact_list_picture);
// Resolve the intent
final Intent intent = getIntent();
// Allow the title to be set to a custom String using an extra on the intent
String title = intent.getStringExtra(UI.TITLE_EXTRA_KEY);
if (title != null) {
setTitle(title);
}
String action = intent.getAction();
String component = intent.getComponent().getClassName();
// When we get a FILTER_CONTACTS_ACTION, it represents search in the context
// of some other action. Let's retrieve the original action to provide proper
// context for the search queries.
if (UI.FILTER_CONTACTS_ACTION.equals(action)) {
mSearchMode = true;
mShowSearchSnippets = true;
Bundle extras = intent.getExtras();
if (extras != null) {
mInitialFilter = extras.getString(UI.FILTER_TEXT_EXTRA_KEY);
String originalAction =
extras.getString(ContactsSearchManager.ORIGINAL_ACTION_EXTRA_KEY);
if (originalAction != null) {
action = originalAction;
}
String originalComponent =
extras.getString(ContactsSearchManager.ORIGINAL_COMPONENT_EXTRA_KEY);
if (originalComponent != null) {
component = originalComponent;
}
} else {
mInitialFilter = null;
}
}
Log.i(TAG, "Called with action: " + action);
mMode = MODE_UNKNOWN;
if (UI.LIST_DEFAULT.equals(action) || UI.FILTER_CONTACTS_ACTION.equals(action)) {
.....
else if (Intent.ACTION_PICK.equals(action)) {
// XXX These should be showing the data from the URI given in
// the Intent.
final String type = intent.resolveType(this);
if (Contacts.CONTENT_TYPE.equals(type)) {
mMode = MODE_PICK_CONTACT;
} else if (People.CONTENT_TYPE.equals(type)) {
mMode = MODE_LEGACY_PICK_PERSON;
} else if (Phone.CONTENT_TYPE.equals(type)) {
mMode = MODE_PICK_PHONE;
} else if (Phones.CONTENT_TYPE.equals(type)) {
mMode = MODE_LEGACY_PICK_PHONE;
} else if (StructuredPostal.CONTENT_TYPE.equals(type)) {
mMode = MODE_PICK_POSTAL;
} else if (ContactMethods.CONTENT_POSTAL_TYPE.equals(type)) {
mMode = MODE_LEGACY_PICK_POSTAL;
}
....
// VERY LONG IF WITH DIFFERENT MODE-SELECTION
....
}
.....
if (mMode == MODE_JOIN_CONTACT) {
setContentView(R.layout.contacts_list_content_join);
} else if (mSearchMode) {
setContentView(R.layout.contacts_search_content);
} else if (mSearchResultsMode) {
setContentView(R.layout.contacts_list_search_results);
} else {
setContentView(R.layout.contacts_list_content);
}
setupListView();
...
}
It's very long method (and I also suggest to check setupListView() method), but pretty straightforward. And, as you can see, there's no parameter you can pass to specify source of contacts you want to pick from. Only thing you can configure here is the particular mMode ContactsApp to use (MODE_PICK_CONTACT, MODE_PICK_PHONE, etc.) - but unfortunately number of possible modes is very limited by 6 and non of them suits you.
(If anyone needs to pass mMode to ContanctsListActivity - use intent's setType() method, for example: intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);)
Workaround
As a workaround - as tiny sunlight's suggested in comments - render non-SIM contacts within the app and pick the one you needed from there.
How to get all android contacts but without those which are on SIM - this link looks like most promising one explaining how to query cursor with all contacts, apart from SIM ones.
I hope, it helps

Integrating and working with .pkpass passes in Xamarin Android app

I'm developing a Xamarin Android app and I need the ability to be able to work with Passes (PassKit passes for example (JSON)). I need to be able to list all the passes in a ListVew and be able to open and display the pass. Also be able to save them to a wallet such as PassWallet or Pass2u. I don't need the ability to create them, just view them, and save them to a wallet or discard them.
There seems to be an example Xamarin iOS app which does exactly what i need here but of course I need to be able to do this in Xamarin Android.
I've been researching this for hours but don't know how to achieve what i need. JSON.net seems the way to go to read the passes, but that's as far as I've managed to get. Some examples would be great. Can anybody help?
To add the pass into PassWallet you can use the following:
private static boolean launchPassWallet(Context applicationContext, Uri uri, boolean launchGooglePlay) {
if (null != applicationContext) {
PackageManager packageManager = applicationContext.getPackageManager();
if (null != packageManager) {
final String strPackageName = "com.attidomobile.passwallet";
Intent startIntent = new Intent();
startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startIntent.setAction(Intent.ACTION_VIEW);
Intent passWalletLaunchIntent = packageManager
.getLaunchIntentForPackage(strPackageName);
if (null == passWalletLaunchIntent) {
// PassWallet isn't installed, open Google Play:
if (launchGooglePlay) {
String strReferrer = "";
try {
strReferrer = "&referrer=" + URLEncoder.encode(uri.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
strReferrer = "";
}
try {
startIntent.setData(Uri.parse("market://details?id=" + strPackageName + strReferrer));
applicationContext.startActivity(startIntent);
} catch (android.content.ActivityNotFoundException anfe) {
// Google Play not installed, open via website
startIntent.setData(Uri.parse("http://play.google.com/store/apps/details?id=" + strPackageName + strReferrer));
applicationContext.startActivity(startIntent);
}
}
} else {
final String strClassName = "com.attidomobile.passwallet.activity.TicketDetailActivity";
startIntent.setClassName(strPackageName, strClassName);
startIntent.addCategory(Intent.CATEGORY_BROWSABLE);
startIntent.setDataAndType(uri, "application/vnd.apple.pkpass");
applicationContext.startActivity(startIntent);
return true;
}
}
}
return false;
}
And an example call is:
launchPassWallet(getApplicationContext(),Uri.parse("http://test.attidomobile.com/PassWallet/Passes/AttidoMobile.pkpass"), true);
You can also use a file:// URL if you have the file locally.
To display them in the list, you'd need to unzip the .pkpass file and then parse the JSON for the relevant fields.

PhoneGap Barcode Scanner Issue

I am developing an application in cordova but my barcode scanner from Zxing opens and closes Automatically after scanning the product in need to add a scan/exit button and a close button the scanner shouldnt open and close automatically. I also need to check if the scanned product exist in the database (SQL SERVER) and return product infomation i have tried to google but to no avail please help.the following is my code in Eclipse. I need to know how i can modify The UI and add my own control of my ZXING barcode scanner plugin i am developing in Eclipse and have a web api service hosted in IIS which i can access on my android App.Please ASAP or show me how i can modify this barcode UI to ADD my controls.
public void scan() {
Intent intentScan = new Intent(SCAN_INTENT);
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}
My OnStartActivity code is here is the code but it seems like it is the same as yours.
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
JSONObject obj = new JSONObject();
try {
obj.put(TEXT, intent.getStringExtra("SCAN_RESULT"));
obj.put(FORMAT, intent.getStringExtra("SCAN_RESULT_FORMAT"));
obj.put(CANCELLED, false);
} catch (JSONException e) {
Log.d(LOG_TAG, "This should never happen");
}
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
this.callbackContext.success(obj);
} else if (resultCode == Activity.RESULT_CANCELED) {
JSONObject obj = new JSONObject();
try {
obj.put(TEXT, "");
obj.put(FORMAT, "");
obj.put(CANCELLED, true);
} catch (JSONException e) {
Log.d(LOG_TAG, "This should never happen");
}
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
this.callbackContext.success(obj);
} else {
//this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
this.callbackContext.error("Unexpected error");
}
}
}
Good Afternoon I have an app that do what you are looking for... first of all I create an intent so i can use any QR scanner I use an external app in order to get the value of the QR code here.
public void scanNow(View view) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}
so in my onStartActivity for result send that info to the server side and I wait for the answer...
public void onActivityResult(int requestCode, int resultCode, Intent intent){
if(requestCode == 0){
if(resultCode == RESULT_OK){
contents = intent.getStringExtra("SCAN_RESULT");// here is the content of the qr scanner
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
String messLoc = "Visita Guardada Con Exito";
Log.i("xZing", "contents: " + contents + " format: " + format);// Handle successful scan
Toast.makeText(this, messLoc, Toast.LENGTH_LONG).show();
new Thread(new Task()).start(); // here I start the thread for the connection
return;
}
else if(resultCode == RESULT_CANCELED);{// Handle cancel
Log.i("xZing", "Cancelled");
}
}
}
Please let me know if this help you
UPDATE:
I just started using Zbar instead Zxing. It's a whole lot easier to work with. Extremely easy to embed (no 3rd party app for the scanner). It has a lot let file to load into the project. Also, it has an included example that you can pretty much copy and paste into your code. The example is perfect for what you are trying to do and would only require a few edits to gain the functions you are looking for. So try using the zbar library.
Zbar - https://github.com/dm77/ZBarScanner
A tutorial - http://community.magicsoftware.com/en/library?book=en/Magicxpa/&page=Android_Barcode_Scanning_(Using_ZBar_SDK)_Sample.htm
The tutorial isn't that good but it helps with setting it up. NOTE: the links they have don't work if you click them..you have to copy and paste the text into your browser.
The database stuff I explained below still is relevant but ignore the parts about zxing.
Best of luck to you!
Original answer
I may be able to help somewhat for you SQL issues. Do you have any database helper set up?
First off I would google around and find a simply database example to set up the database. There are a number of good ones out there that show you how to set up a database in SQLite for android. The one I used to learn some of the basics:http://hmkcode.com/android-simple-sqlite-database-tutorial/ . You can use the example of Book to create a product class with all the values for columns that match your needs. Then you simply create automatic getters and setters with eclipse click "Source -> generate getters and setters". Onces you've done that you can use the tutorial below to set up your qr scanner. As for keeping the window open, I don't think you need to do that. Just create an activity that the scanner closes into. In that acticity you can have the output and have the scan results compared to the database.
I was able to use the tutorial http://%20http://code.tutsplus.com/tutorials/android-sdk-create-a-barcode-reader--mobile-17162 to integrate zxing into my app. Once I did that
An example of parsing the data from the qr code:
First you call the scan:
public void onClick(View v){
//respond to clicks
if(v.getId()==R.id.scanQRButton){
//scan
IntentIntegrator scanIntegrator = new IntentIntegrator(this);
scanIntegrator.initiateScan();
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
The scan results code then looks like this:
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
//retrieve scan result
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanningResult != null) {
//we have a result
scanContent = scanningResult.getContents();
}
else{
Toast toast = Toast.makeText(getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.show();
}
}
Now the finishing method for the scan button:
public void onClick(View v){
//respond to clicks
if(v.getId()==R.id.scanQRButton){
//scan
IntentIntegrator scanIntegrator = new IntentIntegrator(this);
scanIntegrator.initiateScan();
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
formatTxt.setText( "Scan Initiated");
contentTxt.setText(" Scan Results: " + scanContent);
if(scanContent != null){
String userid,medname,tabstaken,dob;
// Here I am breaking apart the scan results and
//saving them into variables.
//Do this then call the database for your product and compare
StringTokenizer st = new StringTokenizer(scanContent, ",");
// token 0
dob = st.nextToken();
//token 1
medname = st.nextToken();
//token 2
tabstaken = st.nextToken();
//token 3
//rxnumber
// So here you setup the db so you can access it
DatabaseHandler db = new DatabaseHandler(getApplicationContext());
//This is used to call the results
HashMap<String,String> user = new HashMap<String, String>();
//Use a method such as getProductResults() for your case
user = db.getUserDetails();
enter code here
//An example of me storing the user
userid = user.get("uid");
//debug.setText("Userid: "+ userid+ " medname: " + medname + " tabs: " +tabstaken);
UserLogEntry userlog = new UserLogEntry(getApplicationContext(),userid,medname,tabstaken);
userlog.addUserLog();
}
}
}
If you need to see my database class let me know. Obviously this isn't the exact code you need, but it shows you how to use the results from the QR and call the DB results to do comparisons. Hopefully its helpful

Categories

Resources