React Native: Can you run a function from the console? - android

I would like to know if or how in React Native it is possible to run a JS function with a console command while the app is running. I need this for debugging. For example let's say in my code I create a function generateFiles(). Is there any way I can call this function from the console? Similar to how you can run JS functions from Chrome's console.
I searched through StackOverflow and Google but didn't find anything on this.

Related

Failed to detect whether we are running on Google Compute Engine

I am trying to use Google Cloud Speech recognition but I get this error
I/omputeEngineCredentials: Failed to detect whether we are running on
Google Compute Engine. W/System.err: java.io.IOException: The
Application Default Credentials are not available. They are available
if running in Google Compute Engine. Otherwise, the environment
variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a
file defining the credentials. See
https://developers.google.com/accounts/docs/application-default-credentials
for more information.
I set the environment variable from System Properties/Environment Variables/User variables and also I set the credentials manually using this guide.
I have searched every topic that is relevant to this, but I can't get it to work. What am I missing?
I faced this issue while connecting to Cloud Storage from local .Following are the steps I followed that worked for me:
Install Cloud SDK. Reference link:Cloud SDK
Follow all the steps to initialize the SDK.
Now ,create application default credentials by using the following command in the root directory of your application gcloud auth application-default login, by which google-cloud will automatically detect your credentials.
It is hard to say without access to logs and code, but probably you should start from debugging accesses to speech API from console directly.
gcloud auth activate-service-account --key-file=[PATH]
gcloud ml speech recognize 'gs://cloud-samples-tests/speech/brooklyn.flac' \ --language-code='en-US'
https://cloud.google.com/blog/products/ai-machine-learning/ml-explorer-talking-and-listening-with-google-cloud-using-cloud-speech-and-text-to-speech
Possible reasons are:
- API is disabled,
- credential you use doesn't contains permissions for ML.
- credential file path is wrong.

How to enable logging option in android and ios devices using xamarin.forms app

In my cross-platform Xamarin Forms application I would like to have a Logging option. If it's enabled, it should generate a log file stating the errors or in which step the app is crashing (if any of these takes places while the app is running) and I should be able to pull and check this generated log file.
When I googled for this I found on many sites that we need to debug using usb and check it on android adb, but once the application goes live and user downloads it in their phone if app crashes any time then the user should be able to turn on the logging button and once the process is run it generates a log file. The user can then send the file to the developer to check what exactly is happening in the system.
How do I implement this feature in Xamarin Forms for both iPhone and Android?
What about analytics service like hokeyapp or appcenter.ms
They do what you and more.
But if you want to implements this by yourself is still possible but you need to write specific code on both plateform to handle exception and write them on files with stack traces

Update UI in android App without making users to update the App

I am building an app using , so the first time I upload the app to playstore, it will go with pre-defined Menu options and other stuffs.
Now, suppose I want to add a menu option in the Header of the App for any festive seasons or some awesome offers, and on clicking the menu, I should display the latest offers.
Is there any way to implement this feature without having to go through the process of again uploading to appstore and making users to update the app??
There is a concept of Over The Air (OTA) updates which you are referring to here. This is provided by Expo (by default create-react-native uses expo), firebase and Microsoft code push. You can read about it more here on official expo docs. If you are not using Expo then i prefer Code Push
Build an api endpoint you call at the app startup seems to be the easiest way to do this. Take a look at firebase if you don't want to build a full api and server yourself. Cloud functions are easy to use and could do the job in your case.

Got ERR_BAN when invoking WeChat for Authorization on Android

I am implementing the "login by WeChat" feature for my Android app.
I followed all the steps on the official developer guide, however, I am consistently getting the error code ERR_BAN in my onResp function in the WXEntryActivity class.
I wonder what does ERR_BAN mean?
What are the possible root causes?
ERR_BAN error is probably happening because you have added the incorrect app signature.
In order to retrieve the correct signature you must download the Android Signature tool from the following link
https://res.wx.qq.com/open/zh_CN/htmledition/res/dev/download/sdk/Gen_Signature_Android2.apk
Install the app, add your app package id and add the generated key to the we chat admin interface:
https://open.weixin.qq.com/cgi-bin/index?t=home/index&lang=zh_CN
(hint: use the chrome translate plugin to navigate on the site, as it is in chinese only)

testing google backend engine on phone

I have an existing android app to which I plan to add Google cloud engine backend. I am following the steps as here
https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae.
I used the option "Google-->generate app engine backend" by right clicking on my existing project. and then went forward to test this.
I started the devapp server( I can see it running at localost:8888/_ah/admin/datastore). However When I run my application, I don't see the device registered in the 127.0.0.1:8888. The application runs as it used to run before. I tried both on emulator and on phone but the application just runs as before but I don't see any device registered in my devappserver.
Am I missing anything here?
Some basic steps for application registration were missing in my application. http://developer.android.com/google/gcm/gs.html
Adding them now and that should solve the problem.

Categories

Resources