I am trying to access to my firebase database like this
FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://YOUR-FIREBASE-APP.firebaseio.com/");
DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;
It's work fine in my android device ,but it's not working in the editor.
I am getting this exception
WebSocket: ws_12 - WebSocketException during handshake
Disable the FirebaseDatabase.dll for Editor platform under
Assets/Firebase/Plugins/Mono/
Then enable the FirebaseDatabase.dll under
Assets/Firebase/Plugins/
I don't know how clean this solution, but it works for me
Firebase.Database.DatabaseReference reference;
// Start is called before the first frame update
void Start()
{
reference = FirebaseDatabase.DefaultInstance.RootReference;
}
A similar thing is happening with me, just reverse it. Reference is working fine in the editor but not on an android device. I checked for the access to the DLL it has been provided in editor and android both.
Related
I want to get getOverrideNetworkType() in android Like as Android CA 5G NSA NR but Enable to Create TelephonyDisplayInfo object to get this. I am using this code but get
TelephonyDisplayInfo mTelephonyDisplayInfo;
mTelephonyDisplayInfo = new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
but get error:-
TelephonyDisplayInfo() is not public in android.telephony.TelephonyDisplayInfo. Cannot be accessed from outside package this error.
Comment from Google support:
Although the constructor is public, it's #hide and not a part of the
API surface, so it shouldn't be accessible to developers. To get the
TelephonyDisplayInfo, please use
PhoneStateListener#onDisplayInfoChanged instead. Closing this as
working as intended.
In Android 6.0/API23 and earlier, the following used to work:
String settingEnabled = android.provider.Settings.Secure.getString(this.getContentResolver(), "enabled_notification_listeners");
In Android 7.0 Nougat/API24 this seems to be no longer supported, because the code above returns null.
It actually was never mentioned here: https://developer.android.com/reference/android/provider/Settings.Secure.html
How do we check if our app has notification access in Android 7.0 Nougat API24?
Edit: It seems that actually that after you first gained the access in the settings, the code above returns the correct state. But not on the initial request after installation.
Use this:
Set<String> packageNames = NotificationManagerCompat.getEnabledListenerPackages (context);
My app was working great until I got it ready for deployment. I have a portion of my app that checks to see if a checkmark is checked in the preferences. Well since I added as a library and am running through another application (created a free version of the app and trying to keep my code as a library) it always returns false.
SharedPreferences appPrefs = context.getSharedPreferences("com.company.widget_preferences", Context.MODE_PRIVATE);
boolean blNotifications;
blNotifications = appPrefs.getBoolean("notifications_new_message", false);
if (blNotifications)
{
//always returns false
}
Thanks for your help.
Figured it out guys. For some reason using SharedPreferences appPrefs = context.getSharedPreferences worked in dev, but as soon as I made it into a Library it didn't like it anymore. The correct way to call a default sharepreference is the following.
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
String value = pref.getString("name_of_my_pref", "default_value");
Thanks again.
Using Flex 4.5 for Android development, this is the script that should create the database:
private var db:File = File.userDirectory.resolvePath("events.db");
private var conn:SQLConnection;
public function MyDB() {
conn = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, openHandler);
conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
conn.open(db, );
}
and I have added this permission:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
but I get this error:
SQLError: 'Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'
at flash.data::SQLConnection/internalOpen()
at flash.data::SQLConnection/open()
at com.galleons.util::MyDB()[/Users/luca/Documents/Adobe Flash Builder 4.5/Galleons/src/com/galleons/util/MyDB.as:24]
I know it's an old question, but anyway I was facing the same error and found the cause. If any of the parent directories of File which you pass to SQLConnection.open() does not exist, Flash Player throws an Error with detailID=1001. Simply call dbFile.parent.createDirectory() and the error should be gone.
Similar answer was given on Adobe Forums: SQLError #3125
Have you checked the 'usual suspects'?
file exists
not locked by some other app / stale version of your app
path is correct
At least part of the problem is due to mixing the SQLConnection class's open() method – which is synchronous – with events that are only supposed to be used when opening an asynchronous connection. You would open an asynchronous connection by using the openAsync() method instead of the open() method.
The docs are contradictory in this matter because it is, in fact, possible to listen for SQLEvent.OPEN when opening a synchronous connection. However, notice that the SQLErrorEvent.ERROR listener is not being triggered in your code and you are instead getting a runtime error. The docs make no mention of SQLErrorEvent.ERROR working with a synchronous connection; that does appear to be the case.
It's possible this is an AIR bug, but I suspect mixing synchronous methods with asynchronous event listeners is just a gray area. It's also likely that the problem could be solved if you instead wrap the open() call in a try/catch block, which is the recommended way to catch synchronous errors:
try
{
conn.open(db);
trace("Hey, is that a database?", (db.exists));
}
catch (err:SQLError)
{
trace("Error, database not created:", err.message);
trace("Error details:", err.details);
}
I want to use Flickr API for downloading the images on Android Phone, can any one give or tell, me about the working sample of Flickr API on Andorid.
I have add the flickr.jar as the external library, and i have the "Key"and "Secret" but i do not know how to download the images.
All it takes is just 3 steps and you will have it implemented.
Step 1: Find your user id.
The easiest way is to use this service http://idgettr.com/
Step 2: Acquire you flickr api key
Just log-in to you account and click this link http://www.flickr.com/services/api/misc.api_keys.html
Step 3: Get the code from the example project from our blog
http://www.quintostdio.com/blog/archives/1117
Add you user id and api key on the FlickrActivity class (in the package com.quintostdio.test.flickr.ui) and run the example. You can copy paste the classes and add it to your project, with no more changes and it will work.
Hi I have built a Flickr Java library for Android: http://code.google.com/p/flickrj-android/
You'll need to look in their documentation on the Flickr site. Most likely will use the Java library and import it into your Android project.
Probably have to instantiate an object, using the Key and Secret. Once you have a valid authentication object, you'll use a provided method (from the docs) to get a picture.
Have a look here: http://www.flickr.com/services/api/
#Todd DeLand answer is pretty accurate even nowadays.
However, I'll speed you up the search and tell you that the flickrj-android is not anymore up to date, as you can check in the Downloads page https://code.google.com/archive/p/flickrj-android/downloads
The other project that is listed in the Flickr API page ( http://www.flickr.com/services/api/ ), Flickr4Java, it's definitely working nowadays since I just tested it today and so far is doing it's job pretty nicely.
Github repo: https://github.com/boncey/Flickr4Java
Gradle config to add in your project (be careful, since in the README it appears another Gradle configuration, which is for the project that Flickr4Java is based on, and is NOT working):
implementation "com.flickr4java:flickr4java:2.17"
As of today, Flickr4Java was last updated on Nov 11, 2017, which is not bad.
This is an example of how I sent a query to get the pictures around a certain location (latitude,longitude):
Thread thread = new Thread(new Runnable() {
#Override
public void run() {
try {
String apiKey = "MY_API_KEY";
String sharedSecret = "MI_API_SECRET";
REST rest = new REST();
Flickr flickrClient = new Flickr(apiKey, sharedSecret, rest);
SearchParameters searchParameters = new SearchParameters();
searchParameters.setLatitude(exampleLatitude);
searchParameters.setLongitude(exampleLongitude);
searchParameters.setRadius(3); // Km around the given location where to search pictures
PhotoList photos = flickrClient.getPhotosInterface().search(searchParameters,5,1);
} catch (Exception ex) {
Log.d(MapApplication.LOG_TAG, ex.getLocalizedMessage());
}
}
});
thread.start();
I would avoid flickr4java. I assumed it worked at first but after incorporating it in to my project I have found that it crashes the app intermittently. very annoying and has been a big waste of time :(. probably works fine under other java apps but does not seem to play well with android :(