Parse Configuration in Android with Smartface App Studio - smartface.io

I am trying to config Parse plug-in into my android app with Smartface App Studio. I followed the link http://www.smartface.io/developer/guides/advanced/push-notification-on-parse-services/#before450 with Smartface App Studio 4.5 version.
But, the device is not getting registered with parse and even not getting any fail message.
Can any one help on this. Thanks in advance.

You are using Smartface 450, so the document you should check is this one below:
http://www.smartface.io/developer/guides/advanced/push-notification-on-parse-services/#after450
You can use the below code on Global.Smartface.js in order to see if it registered or not:
alert("Registration is successful : \n" + Parse.getToken("Landroid/app/Activity;"));
And in Page1.onShow, you can use parse methods as below:
Parse.onRegistrationFail = function () {
alert("Parse Registration failed");
};
// if the application is open and receives notification
Parse.onParsePushReceive = function () {
alert("app opened : \n\n" + Parse.getData());
};
//if the application is closed and get opened by a parse notification
if (Parse.openedByParseNotification()) {
alert("app opened by a notification : \n\n" + Parse.getData());
}

Related

'Detection updating interface' in Unity3D Engine for Huawei AppGallery

How can I implement 'update interface' when a new app version is released based on Unity3D?
I have received this message from AppGallery review team : "We found that the detection updating interface isn't called in HMS after the app's startup".
The only documents that I have found is for implementing in Android studio in this link : Updating an App
After an app is launched or when a user proactively checks whether there is a later version, call the related API of the HMS Core SDK to check whether there is a later version available on AppGallery. If so, display a pop-up asking the user whether to update the app.
The key steps for achieving this function are as follows:
A user triggers an update check, for example, by launching the app or manually performing the check on the update check page.
The app calls JosApps.getAppUpdateClient to request to initialize the AppUpdateClient instance.
AppUpdateClient client = JosApps.getAppUpdateClient(this);
The HMS Core SDK returns the AppUpdateClient instance of the current app to the app.
The app calls the AppUpdateClient.checkAppUpdate method to request an update check.
public void checkUpdate() {
AppUpdateClient client = JosApps.getAppUpdateClient(this);
client.checkAppUpdate(this, new UpdateCallBack(this));
}
The HMS Core SDK queries the latest app version information on AppGallery.
AppGallery sends the app version information back to the HMS Core SDK.
The HMS Core SDK sends the check result to the app through a callback.
The app checks the ApkUpgradeInfo instance returned by the onUpdateInfo method in the callback result and checks whether an update is available.
private static class UpdateCallBack implements CheckUpdateCallBack {
private WeakReference<MainActivity> weakMainActivity;
private UpdateCallBack(MainActivity apiActivity) {
this.weakMainActivity = new WeakReference<MainActivity>(apiActivity);
}
public void onUpdateInfo(Intent intent) {
if (intent != null) {
MainActivity apiActivity = null;
if (weakMainActivity != null && weakMainActivity.get() != null){
apiActivity = weakMainActivity.get();
}
// Obtain the update status code. Default_value indicates the default return code when status cannot be obtained, which is determined by the app.
int status = intent.getIntExtra(UpdateKey.STATUS, DEFAULT_VALUE);
// Error code. You are advised to record it.
int rtnCode = intent.getIntExtra(UpdateKey.FAIL_CODE, DEFAULT_VALUE);
// Failure information. You are advised to record it.
String rtnMessage = intent.getStringExtra(UpdateKey.FAIL_REASON);
Serializable info = intent.getSerializableExtra(UpdateKey.INFO);
// Check whether the app has an update by checking whether info obtained is of the ApkUpgradeInfo type.
if (info instanceof ApkUpgradeInfo) {
// Call the showUpdateDialog API to display the update pop-up. The demo has an independent button for displaying the pop-up. Therefore, this API is not called here. For details, please refer to the checkUpdatePop() method.
if (apiActivity != null) {
apiActivity.showLog("There is a new update");
apiActivity.apkUpgradeInfo = (ApkUpgradeInfo) info;
}
}
if(apiActivity != null) {
apiActivity.showLog("onUpdateInfo status: " + status + ", rtnCode: " + rtnCode + ", rtnMessage: " + rtnMessage);
}
}
}
}
The app calls the AppUpdateClient.showUpdateDialog method to request to display the update pop-up for the user.
public void checkUpdatePop(boolean forceUpdate) {
AppUpdateClient client = JosApps.getAppUpdateClient(this);
client.showUpdateDialog(this, apkUpgradeInfo, forceUpdate);
Log.i(TAG, "checkUpdatePop success");
}
The HMS Core SDK displays the update pop-up for the user.
The user chooses to update the app on the update confirmation page.
The HMS Core SDK sends a request to AppGallery to download the latest app installation package.
AppGallery returns the app package to the HMS Core SDK. The HMS Core SDK starts to install the app after the download is complete.
For more details, pls kindly check this docs.

Ionic printer plugin not working on ios for external link

I am trying to print external link into ionic app using ionic printer plugin
https://ionicframework.com/docs/native/printer/
printticket(){
let printurl = "http://www.gmail.com";
let options: PrintOptions = {
name: 'Waridi Events',
duplex: true,
landscape: false,
grayscale: false
};
this.printer.print(printurl, options).then(onSuccess=>{
console.log("Done =>" + onSuccess);
}, onError=>{
console.log("Error=>"+onError);
});
}
This is working on android but not working on ios. Please give me some better way to print.
sometimes it is working
And sometimes failed to load data
Finally I got the solution using api call.
Before call the print call the api from the link and get the html codes and save all into a variable and print it.

Issue with register device in MFP8.0

We are developing ionic app with mfp8.0. We have tried to register our device for push notification by using the following code,
function isPushSupported() {
MFPPush.isPushSupported(
function(successResponse) {
alert("Push Supported: " + successResponse);
registerDevice();
}, function(failureResponse) {
alert("Failed to get push support status");
}
);
}
function registerDevice() {
WLAuthorizationManager.obtainAccessToken("push.mobileclient").then(
MFPPush.registerDevice(
null,
function(successResponse) {
alert("Successfully registered");
},
function(failureResponse) {
alert("Failed to register device:" + JSON.stringify(failureResponse));
}
)
);
}
Not able to register the device now. While getting inside the registerDevice() function App is getting stopped.
Actually, We are getting this error recently. Before that the same code was working fine for us.
I have referred the documentation. But, I am not getting the solution.Link which I have reffered is,
https://github.com/MobileFirst-Platform-Developer-Center/PushNotificationsCordova/blob/release80/www/js/index.js
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/
Note:
GCM recommeded to make use of FCM now, refer the following link,
https://developers.google.com/cloud-messaging/
Actually, after register my device with FCM credentails only I am facing the issue.
Anyone help will be Appreciated!!!
Please make sure you are following the correct instructions. The instructions are layed out in the following page: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/
Visit the Firebase Console.
Create a new project and provide a project name.
Click on the Settings "cog wheel" icon and select Project settings.
Click the Cloud Messaging tab to generate a Server API Key and a Sender ID. and click Save.

Getting error unsupported_response_type

I am working on login with google functionality with $cordovaOauth.google plugin. But I am getting unsupported_response_type error.
$cordovaOauth.google("MY_APP_ID", ["https://www.googleapis.com/auth/urlshortener", "https://www.googleapis.com/auth/userinfo.email"]).then(function (result) {
console.log(JSON.stringify(result));
alert(JSON.stringify(result));
$scope.gdata = result;
}, function (error) {
console.log(error);
});
Where I am making mistake !?
Yes because $cordovaOauth plugin loading webview so you must need web clientID from Google API. And that will not work for ionic ( Mobile app ) so you need to do following things.
First
You need to use schema for your app to give internal URL like google:// or twitter://
Reference : http://mcgivery.com/using-custom-url-schemes-ionic-framework-app/
and provide that custom URL in Google redirect url ( This is not working all time as Google not accept custom URL but you can give it a try ).
Second and Working solution :
You need to create Google app with your app identifier and keytool.
For Android :
https://developers.google.com/identity/sign-in/android/start follow step second and provide your app name and unique identifier ( i.e dipesh.cool.com )
For iOS : 
https://developers.google.com/mobile/add?platform=ios&cntapi=signin
same information as mentioned for android.
Then you need to get REVERSED_CLIENT_ID value from the config file which download will be available once you are done with above two steps ( you can grab it from iOS config file it is easy to find from that file ).
And then simply run below command and code and you will have all working.
Command :
cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=GRAB_THIS_FROM_IOS_OR_ANDROID_CONFIG_FILE
Angular code :
$scope.GoogleLogin = function()
{
$scope.loaderShow('Google');
window.plugins.googleplus.login({},function (obj)
{
window.localStorage.setItem('signin', 'Google');
window.localStorage.setItem('g_uid', obj.userId);
window.localStorage.setItem('g_fname', obj.givenName);
window.localStorage.setItem('g_lname', obj.familyName);
window.localStorage.setItem('user_full_name', obj.displayName);
window.localStorage.setItem('g_email', obj.email);
window.localStorage.setItem('gotPdetails', 'false');
$scope.loaderHide();
$state.go('app.dashboard');
},
function (msg)
{
$scope.showAlert('Google signin Error<br/>'+msg);
$scope.loaderHide();
});
}

Processing incoming APP link Titanium Studio Iphone

I'm using Titanium's facebook module to show a apprequests dialog. I could send application request and when I get into the facebook app and hit the notification, I could get into my app.
But, how do I process the incoming URL? I went through the link Deep link with requests
that shows how to do it with Objective C. Any help on how to implement it with Titanium Studio would be appreciated. Thanks.
You can get the arguments with this snippet :
var cmd = Ti.App.getArguments();
if ( (getTypeOf(cmd) == 'object') && cmd.hasOwnProperty('url') ) {
Ti.App.launchURL = cmd.url;
Ti.API.info( 'Launched with url = ' + Ti.App.launchURL );
}
this is called the URLScheme, if you are looking for online docs!
Source: http://developer.appcelerator.com/question/120393/custom-url-scheme---iphone--android