Sending unique ID to database from Android phone - java

I am implementing fingerprint using AndroidX biometrics.
But now I want to sent some unique ID/Name to database to put into database timestamp.
But for now I read that I cant access fingerprint in my phone.
Is there any kind of thing that I could sent to database? Unique phone ID?

You can use AdID
Kotlin example
var id = AdvertisingIdClient.getAdvertisingIdInfo(this.getApplicationContext()).getId() //kotlin
Java Example
String id = AdvertisingIdClient.getAdvertisingIdInfo(this.getApplicationContext()).getId() //Java
Refer this documentation for more details
https://developer.android.com/training/articles/user-data-ids#java

Try this code
String android_id = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ANDROID_ID);
Let me know if this works

Related

How to get the Push id of current user in Firebase Android?

I have generated the push id of the user who have sign up.
String id=databaseUser.push().getKey();
How I can get this id when the user signs in?
Please help me on this.
You can store that id in the database as a property of your User object but a more elegant way would be to use the uid and not that random key provided by the push() method. So once you are authenticated, you can get the uid, using the following line of code:
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();

Firebase Database Query Data

I am new to Firebase Database, I am making an android app in which the structure of the data is like this :
{
posts={
-Ks4AoL7F-oKtwd3M8Ao={
address=Address of mine,
title=Title ,
subcategory=E-waste, category=Garbage,
time=21-08-2017 07:54 p.m.,
mobileNumber=some mobile number,
comment=hhdhdehsbsbhs,
statusText=Pending,
imagePath=https://firebasestorage.googleapis.com/v0/b/path-to-image
},...
}
So in this structure i want to query the posts on the basis of the mobile number i.e., if the mobile number matches than the current post will be retrieved else skip this post and check for next post and so on...
you can get all the list of data from post object with the help of simple queries which you can find in documentation part of firebase, where you can check for each object's mobile no, accordingly apply the conditions to keep or discard the object.
for more info please look into the link:-
sample to retrieve the data from firebase
You can refer this post and
This

What is the right way to create Datastore Entity and use it in Dataflow pipeline

Which of these is the correct / preferred way to create Datastore Entity:
// First, create a fake email for our fake user
final String email = "me#fake.com";
// Now, create a 'key' for that user using the email
final Key userKey =
datastore.newKeyFactory().kind("user").newKey(email);
// Now create a entity using that key adn add some fields to it
final Entity newUser =
Entity
.builder(userKey)
.set("name", "Faker")
.set("email", email)
.build();
or like it's done in DatastoreWordCount example ?
Entity from the first example is com.google.cloud.datastore.Entity.
Entity from the second example is com.google.datastore.v1.Entity.
I have code using com.google.cloud.datastore.Entity and I don't know how to store it Datastore as a part of Dataflow pipeline, since all code examples I found online suggest:
com.google.cloud.dataflow.sdk.io.datastore.DatastoreIO.v1().write()
but it's only working with com.google.datastore.v1.Entity.
I'm using com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:1.7.0.
You have analyzed the situation well - Dataflow's DatastoreIO.v1() works with com.google.datastore.v1.Entity.

Using Baas Parse for Android application but duplicate Table User

I 'm trying to use the Baas Parse for my Android application.
I've followed the quickstart guide with success, so i'have successfully registered a TestObject into my Parse database.
Now, I try to adapt Parse to my needs and to register a User into Parse database with that code:
Parse.initialize(this, "NkThBbZ4gcXQf3s59UGTozpCjKQbECVP5SmuXCkY", "n7a65t3o8fZNAXTOygWIg2L9Kui316yepfgoSdhf");
ParseObject userParse = new ParseObject("User");
userParse.put("username", user.getPseudonyme());
userParse.put("password", user.getPassword());
userParse.saveInBackground();
But it doesn't insert my user into the User table, instead it creates a new table and insert my User in that new User table.
The first User table is a default table created by parse as far as i understand but i don't understand why is it impossible to use it.
The result is that i have 2 Users tables.
Thank you very much for your answers if anyone had the same problem.
Sebastien
The pre-made User table actually has an underscore before it. It is the _User table, not the User table. The underscore is to signify it's a special class that Parse gives you. Use _User instead of User.

Store the Value Permanent?

I have an app, In this signIn through the dropbox and after the signIn I got the vale of below I declared:
DropboxAPI<AndroidAuthSession> mDBApi;
What I want is :
I want to use this value(get this value) after my Phone Reboot.
Or
I want to store this Value Permanent.
For better understand have a look on this Link : DROPBOX_REFERENCE_LINK
For this WHAT I tried :
I did static but it's working fine till Phone is Switch on. Does not mean !
Use SharedPrefrence but I have to put this value into the String but In the time of typeCast , I am not able to convert this String value into the DropboxAPI Generic Type.
LIKE :
String s = mDBApi_From_Prefrence;
DropboxAPI<AndroidAuthSession> mDBApi = `TypeCast From String s to DropboxAPI<AndroidAuthSession>`
What Should I do store this mBDApi value PERMANENT ?
You can store this value to a SQLite Database as a BLOB type and fetch it again. Databases remain persistent for the app even after reboot.

Categories

Resources