Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Firebase SDK on devices without Google Play Services #223

Open
IanPhilips opened this issue Oct 10, 2018 · 49 comments
Open

Support Firebase SDK on devices without Google Play Services #223

IanPhilips opened this issue Oct 10, 2018 · 49 comments

Comments

@IanPhilips
Copy link

IanPhilips commented Oct 10, 2018

I'm using unity 2018.3.0b2 and the firebase sdk 5.3.1 to build on my Oculus Go.

At startup I get this in my debug:
Firebase App initializing app com.eyeflite.wingvr

That's the last I see from my firebase debug output (no auth initiated or sign in attempt made). Then, I'm prompted with a system dialog that " {my app} won't run without play services which weren't supported by your device"

I hadn't seen this system prompt on 5.3.0 and the auth system was working fine. Any ideas about what's going on?

This is in my Awake() function:

  Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
	var dependencyStatus = task.Result;
		if (dependencyStatus == Firebase.DependencyStatus.Available) {
			// Create and hold a reference to your FirebaseApp, i.e.
			app = Firebase.FirebaseApp.DefaultInstance;
			auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
			Debug.Log("auth inited!");
			SignInAndGetToken();

	} else {
		UnityEngine.Debug.LogError(System.String.Format(
			"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
		// Firebase Unity SDK is not safe to use here.
	}
		});
@stewartmiles
Copy link
Contributor

Almost all Firebase SDKs on Android compatible devices require Google Play Services. In particular the Unity SDK is built on top of the C and, transitively, the Android SDK which requires Google Play Services detailed here:
https://firebase.google.com/docs/cpp/setup#requiring_google_play_services

@IanPhilips
Copy link
Author

just reverted to sdk version 5.3.0 and no system dialog is displayed

@IanPhilips
Copy link
Author

IanPhilips commented Oct 10, 2018

@stewartmiles I'm not sure what you mean, the sdk works as described on the getting started page as of 5.3.0 and as of 5.3.1 a system error dialog is displayed with the same code.

@stewartmiles
Copy link
Contributor

@IanPhilips that's curious, what components in Firebase are you using? We did update the Android SDK library versions in the 5.3.1 SDK (see the *Dependencies.xml` files and the delta between them) so it's possible one of the libraries added a dependency upon Google Play Services that didn't exist before. If you're using anything other than Analytics, I would expect this to not work on any device that doesn't have the Play Store and Google Play Services.

@IanPhilips
Copy link
Author

I'm only using Firebase.Auth

@stewartmiles
Copy link
Contributor

Yep Auth definitely requires Google Play Services.

FWIW: https://developer.oculus.com/documentation/mobilesdk/latest/concepts/book-intro/ says...

No Google Play Services. Unlike the Samsung Galaxy devices that run Gear VR, Oculus Go does not ship with Google Play Services installed. You cannot rely on Google Play Services (e.g. Google Firebase, Google Cloud Messaging, etc) when running on Oculus Go.

@IanPhilips
Copy link
Author

I saw that when I was looking around but I'm still confused why 5.3.0 would work and 5.3.1 wouldn't.

@stewartmiles
Copy link
Contributor

Auth was upgraded in 5.3.1 and we've moved to require the most recent version of Google Play Services. If you side-load the latest Google Play Services it may (probably won't) work.

@IanPhilips
Copy link
Author

Haha, okay thanks for your help. I wonder where the outdated Google Play Services is coming from...

@stewartmiles stewartmiles changed the title 5.3.1 firebase sdk for unity on Oculus prompts system dialog play services not supported Support Firebase SDK on devices without Google Play Services Oct 23, 2018
@jcyh0120
Copy link

jcyh0120 commented Dec 3, 2018

Is there a guide if I want to develop for oculus go with firebase?

@IanPhilips
Copy link
Author

@jcyh0120 you probably should not use firebase or if you have to, use the REST API

@tairam
Copy link

tairam commented Mar 11, 2019

I need to use cloud storage with oculus go. Is it possible with RESTAPI?

@alexames
Copy link

@tairam Nope, the only officially supported way to use Firebase Storage is through the official APIs.

@stewartmiles
Copy link
Contributor

@tairam it is possible to use the REST API instead of the SDK, it's work but it's possible.

@yezzerfv
Copy link

yezzerfv commented Aug 6, 2019

Are there plans to get Firebase working on devices without Google Play Services? While it may be possible to use the REST API with quite a lot of additional effort, the lack of built-in support means Oculus Go, Oculus Quest, and other HMDs running a flavour of Android (eg: HTC Focus?) means Firebase is a bad choice for developers. A shame, because it's my preferred solution on all the other platforms!

We're going to see more VR (and AR?) HMDs using Android be released, and to put up barriers for using Firebase on this emerging market seems a strange decision.

@stewartmiles
Copy link
Contributor

@yezzerfv we're working on moving some components with the first one being Authentication on Android. This will allow the use of Auth, Function, Realtime Database, Storage and - eventually - Firestore, without Google Play Services.

Which products would you need to work?

@Zhelyazko
Copy link

What about Analytics / Crash reporting? I'm using them in a classic native (no Unity) Android app in an enterprise environment where Google Play Services is not available. Do you plan on migrating Analytics / Crash reporting / Performance monitoring w/o Play Services?

@yahavt
Copy link

yahavt commented Aug 12, 2019

@stewartmiles I think that for most of us in the VR world the priorities are (in this order):

  1. Auth
  2. Realtime Database
  3. Storage
  4. Functions / Firestore

I've been using your REST API for some time now to bypass this limit, but the downside is that the VR app and the firebase server data will be less secure.

@stewartmiles
Copy link
Contributor

@Zhelyazko Google Analytics for Firebase doesn't require Google Play Services. I'm fairly sure that Crashlytics & Performance Monitoring currently have a dependency upon Instance ID which does require Google Play Services. We may change this dependency in future.

@yahavt as I mentioned we're moving Auth at the moment. So all of the products you've listed will be functional on devices without Google Play Services.

@metallizard
Copy link

Hi @stewartmiles

When / which version of firebase unity SDK that support Auth, firestore and storage to function without google services? I really would like to know because currently we're migrating to Oculus Quest from Cardboard and stuck with this issues :(

We were considering to Develop our own API using the REST API but it will take a while as well

@stewartmiles
Copy link
Contributor

@metallizard the Android code is written to turn Firebase Auth into a thick client but it's going through review. We then need to alpha test it with Android devs before we can release it to the public with the C and Unity SDK updates to remove the check for Google Play Services being present if Firebase Auth is being used. Right now the timeline is at least a couple of months.

@metallizard
Copy link

So we can expect for Unity SDK at least a couple of months for now?

For now my apps need REST API then. Thank you for the info

@denonzhu
Copy link

MLkit barcode scanner can work without google play service? i had get the offline lib ,but it not work wihout goole play ~~~

@vorporeal
Copy link

@stewartmiles Any chance it would be possible to be part of an alpha testing group? I'm looking to use firebase for a prototype of an application for oculus quest; wouldn't mind rough edges or bugs or significant initial setup.

Alternatively, any guesses as to whether leveraging https://github.com/FirebaseExtended/auth-without-play-services to provide Firebase Auth would be sufficient to get the existing Unity SDK Realtime Database component working?

@jyin96
Copy link

jyin96 commented Aug 27, 2019

I would also be interested in opting into an alpha/beta of this. I'm looking to use Firebase for a quest application early-2020, and would like to start building out the infrastructure.

The components that I'm looking to use are Firebase Auth and Storage

@stewartmiles
Copy link
Contributor

@vorporeal and @jyin96 I'll let the team know who are working on this.

@yezzerfv
Copy link

yezzerfv commented Aug 27, 2019 via email

@olivernash
Copy link

olivernash commented Aug 27, 2019 via email

@ampeixoto
Copy link

@Zhelyazko Google Analytics for Firebase doesn't require Google Play Services. I'm fairly sure that Crashlytics & Performance Monitoring currently have a dependency upon Instance ID which does require Google Play Services. We may change this dependency in future.

@yahavt as I mentioned we're moving Auth at the moment. So all of the products you've listed will be functional on devices without Google Play Services.

@stewartmiles you said that Google Analytics for Firebase doesn't require Google Play Services, but if I log an event using the Firebase Analytics, I get the following logs in logcat:
image

I setup Firebase Analytics as the tutorial: https://firebase.google.com/docs/analytics/android/start/

How should I setup my project so that I can user Firebase Analytics without Google Play Services (or with an outdated version)?

Is there any place where we can see the information of which Firebase components require Google Play Services?

@yiliushenburke
Copy link

@stewartmiles , thanks for clarifying. I'm getting what seems to be a similar error when running a project on the Oculus Quest that includes the Auth and Storage SDKs (version 6.4.0):

2019-09-17 23:31:39.531 14226-14250/? E/Unity: InitializationException:  Firebase modules failed to initialize: auth (missing dependency), storage (missing dependency)
      at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x000e3] in <376fb5a5a3524225a54a2d810ebdc8a6>:0 
      at Firebase.FirebaseApp.Create () [0x00027] in <376fb5a5a3524225a54a2d810ebdc8a6>:0 
      at Firebase.FirebaseApp.get_DefaultInstance () [0x00017] in <376fb5a5a3524225a54a2d810ebdc8a6>:0 
      at Softspace.Apis.Firebase.FirebaseAuthClient.get_App () [0x00008] in <0290aec2e5d14994a3f043bd564f16aa>:0 
      at Softspace.Apis.Firebase.FirebaseAuthClient.get_Auth () [0x00008] in <0290aec2e5d14994a3f043bd564f16aa>:0 
      at Softspace.Apis.Firebase.FirebaseAuthClient.Awake () [0x00000] in <0290aec2e5d14994a3f043bd564f16aa>:0

This exception is thrown when the code tries to get the property FirebaseApp.DefaultInstance.

This is different from what @IanPhilips reported; there's no explicit reference to Google Play Services in my case. Is this still being caused by the same issue?

Regardless, we're also building for the Quest, and would love to be added to any alpha with a version of the SDK that doesn't need Google Play Services!

Thanks a bunch.

@solarisn
Copy link

Has anyone been able to get Firebase Analytics working on Oculus Go or Quest (no play services)? We have to make an analytics decision for a long-term project and would like to use Firebase. We're a VR/AR company so Play Services dependency is disqualifying.

For anyone else in a similar situation - I recommend checking out Segment to provide a REST API for you. The events can be forwarded to Firebase (and many other destinations) automatically. They don't actually have a first-party client SDK for Unity but there's a "community" integration here. It won't work as-is but I made a couple modifications and it's working great. If anyone is interested in my fixed version of that Segment Unity SDK, let me know and I'll create a public fork.

@SkyeOfBreeze
Copy link

SkyeOfBreeze commented Oct 18, 2019

I have had success recently with Firebase Analytics. As is, if the keys are setup properly (does not seem to auto update when changing package name via script, but might for you), it will schedule the data to be sent every hour, but within that time, the user could power down the headset or uninstall within that time and the events are potentially lost.

Had to modify it to send the data immediately on exit like iOS does, and this could also be used to customize the sending window

To make it reschedule, we called this code in onPause in an overridden Android activity. Maybe it would be best to have this functionality built into Firebase Analytics to send the data immediately but this seems pretty reliable for our uses without waiting for an update. We are not checking for existence of Google play services when using it, and we call this function on all devices. It only runs the service if the device does not have Google Play services.

//Java
private void MaybeRescheduleJobServiceImmediate() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            JobScheduler jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
            ComponentName name = new ComponentName(getPackageName(),
                    "com.google.android.gms.measurement.AppMeasurementJobService");
            JobInfo job = getJob(name);
            if(job != null){
                jobScheduler.cancel(job.getId());
                JobInfo.Builder builder = new JobInfo.Builder(
                        job.getId(),
                        job.getService()
                );
                builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY); //this might need changed?
                builder.setMinimumLatency(1).setOverrideDeadline(1);
                builder.setExtras(job.getExtras());
                jobScheduler.schedule(builder.build());
            }
        }
    }

    @RequiresApi(21)
    @Nullable
    private JobInfo getJob(ComponentName name) {
        JobScheduler jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
        for(JobInfo info : jobScheduler.getAllPendingJobs()){
            if(info.getService().getClassName().equals(name.getClassName())){
                return info;
            }
        }
        return null;
    }

Edit: Also worth noting that Oculus will throw warnings/errors when trying to use Firebase Analytics in the project for any builds submitted (because it detects the use of Google Mobile Services). Not sure if Oculus plans on blocking builds at some point that trigger that warning, or what exactly needs to be manually pulled out to make the error go away without breaking anything

@kostyabakay
Copy link

So for today is it impossible to use Crashlytics on AR helmet without Google Play Services?

@pahayah
Copy link

pahayah commented Nov 19, 2019

So when can we expact the decoupling of Google Play for Unity so that Oculus Quest could work? We want to use mainly Auth and Realtime Database.

@vorporeal
Copy link

Any updates on alpha availability? Or, alternatively, any suggestions on how we could temporarily hack around the dependency to unblock development?

@spobwoode
Copy link

1 for Firebase Quest support

@yiliushenburke
Copy link

yiliushenburke commented Jan 17, 2020

Is this an issue the Firebase team is still working on?

@stewartmiles
Copy link
Contributor

It's still being worked on, we have some services like Auth that are far harder to move than others so this is taking a while to get this out the door. We appreciate folks continuing to signal their need for this so feel free to keep on commenting which features you need to work on non-Google Play Services devices.

@yiliushenburke
Copy link

yiliushenburke commented Jan 18, 2020 via email

@olivernash
Copy link

Thanks @stewartmiles

That's good to hear and 1 for Firebase Quest support.

Auth and Firestore would be great.

@dayron9110
Copy link

@stewartmiles Hi, I am very worried because the Huawei personal contact me and they explained that new phones do not will have Play Services Installed(Old news). The app in the I work currently uses differents Google Services: play-services-ads,play-services-auth,firebase-messaging,firebase-analytics, Crashlytics, Google Sheets, Google Drive. Which of the previous libs Can I utilize without Play Services or Play Store installed on the new Huawei phones? Thanks for your help.

@stewartmiles
Copy link
Contributor

@dayron9110 unfortunately, we still don't have a timeline in place to support devices without Google Play Services. Requirements for the Google Play Services APK / service / daemon (which isn't on these devices) are here. For G Suite APIs (Drive, Sheets etc.) you'll need to consult that team https://developers.google.com/gsuite/guides/android as I'm not sure whether their SDK logic is in the client library or in the Google Play Services APK.

@3skild
Copy link

3skild commented Mar 5, 2020

Hope that this will be fixed. I have to change to something else because it is not running on Oculus Quest.

@vrajasu
Copy link

vrajasu commented Mar 17, 2020

@stewartmiles : What is the current stand on Firebase Analytics without Google Play Services?

@Tubyhes
Copy link

Tubyhes commented Mar 30, 2020

Still very much looking forward to support for at least Auth and Firestore without Google Play Services!

@yiliushenburke
Copy link

yiliushenburke commented Mar 30, 2020 via email

@bonchan
Copy link

bonchan commented Mar 30, 2020

1 for Firebase Quest support.
Im using Real Time Database and Storage, do I need Auth too?
any updates @stewartmiles ?
thanks for your work!

@dknchris
Copy link

dknchris commented Apr 9, 2020

1 For this. Firebase Auth, Database, Crashlytics needed without Play Services requirement. Please put this issue on priority as this will allow us to reach more users especially in China and also some privacy conscious users who do not use Google Apps on their devices.

@firebase firebase locked as too heated and limited conversation to collaborators Apr 13, 2020
@katowulf
Copy link

Hi folks, as noted several times in the thread, we hear the request and understand the need. Some Firebase services may never work without Play, some are taking a very long time to find solutions for. There are many blockers and complexities to this request, but it's definitely important to us.

Locking thread to prevent more "ETA please" requests (which will not help to prioritize this further and ultimately make it take longer as we spend more time answering them).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests