I used this within my app:
if(ENV_DEVELOPMENT) {
Ti.API.info('Environment: DEVELOPMENT');
alert('Environment: DEVELOPMENT');
}else if(ENV_TEST) {
Ti.API.info('Environment: TEST');
alert('Environment: TEST');
}else if(ENV_PRODUCTION) {
Ti.API.info('Environment: PRODUCTION');
}
The App has just been published in the stores and it's alerting 'Environment: TEST'.
Is there any reason why a published app should give ENV_TEST = true??
Related
How can i send Firebase cloud token to my android app to open my app deeplink?
I implemented deeplink and its worked
Then config my firebase FCM and my laravel send notification to my android device. with this library
https://github.com/brozot/Laravel-FCM
i cant find any method to send link but
function sendNotification($user_id, $type)
{
$message = getNotificationMessage($type);
try {
$fcm_tokens = ClientInfo::where('user_id', $user_id)->all();
foreach ($fcm_tokens as $key => $fcm_token) {
$optionBuilder = new OptionsBuilder();
$optionBuilder->setTimeToLive(60 * 20);
$notificationBuilder = new PayloadNotificationBuilder();
$notificationBuilder->setBody($message)
->setSound('default')
->setClickAction('bazarshahr://customer.app/order');
$dataBuilder = new PayloadDataBuilder();
$dataBuilder->addData(['deeplink' => 'bazarshahr://customer.app/product/39']);
$option = $optionBuilder->build();
$notification = $notificationBuilder->build();
$data = $dataBuilder->build();
$token = $fcm_token['firebase_token'];
$downstreamResponse = FCM::sendTo($token, $option, $notification, $data);
$downstreamResponse->numberSuccess();
$downstreamResponse->numberFailure();
$downstreamResponse->numberModification();
// return Array - you must remove all this tokens in your database
$downstreamResponse->tokensToDelete();
// return Array (key : oldToken, value : new token - you must change the token in your database)
$downstreamResponse->tokensToModify();
// return Array - you should try to resend the message to the tokens in the array
$downstreamResponse->tokensToRetry();
// return Array (key:token, value:error) - in production you should remove from your database the tokens
$downstreamResponse->tokensWithError();
}
} catch (Exception $e) {
SystemLog::error(sprintf("[helpers.sendNotif] Can't send Nofication: %s (%d)", $e->getMessage(), $e->getCode()));
return false;
}
return true;
}
This feature is not mentioned in Fcm documentation but i tried some sort of tests on my own and figured out the solution: as we replied here
Instead of click_action we need to put link:
https://fcm.googleapis.com/fcm/send
Content-Type: application/json
Authorization: key={SERVER_KEY}
{
"to" : "{Firebase client token}",
"collapse_key" : "type_a",
"notification" : {
"body" : "Body of Your Notification",
"title": "Title of Your Notification"
"link": "example://my.app/products" <<-- Here is the solution
}
}
I am building an app in React-Native and need to have location access as per the requirement.
I have tried using react-native-fused-location for the same, as below.
FusedLocation.setLocationInterval(20000);
FusedLocation.setFastestLocationInterval(15000);
FusedLocation.setSmallestDisplacement(10);
FusedLocation.setLocationPriority(
FusedLocation.Constants.HIGH_ACCURACY
);
FusedLocation.startLocationUpdates();
FusedLocation.getFusedLocation().then(location => {
if (location != null) {
let initialPosition = JSON.stringify(location);
this.state.latitude = location.latitude;
this.state.longitude = location.longitude;
this.state.timestamp = location.timestamp;
this.state.initialPosition = initialPosition;
} else {
alert("Location unavailable, please try later");
}
}).catch(error => { // fused location catch
console.log("location retrieval failed");
});
The only output, I am receiving with the above code, in case of Oreo 8.0.0 is E/request: 100.
also tried the other way as below
navigator.geolocation.watchPosition(
location => {
console.log("inside watchPosition location");
if (location != null) {
console.log("location is not null");
let initialPosition = JSON.stringify(location.coords);
this.state.latitude = location.coords.latitude;
this.state.longitude = location.coords.longitude;
this.state.timestamp = location.coords.timestamp;
this.state.initialPosition = initialPosition;
} else {
alert("Location unavailable, please try later");
}
},
error => {
console.log("calling ShowHideActivityIndicator, getLocationWithNavigate (ios)");
this.ShowHideActivityIndicator(false);
alert("location retrieval failed");
console.log(error);
},
{ timeout: 20000, enableHighAccuracy: true, distanceFilter: 10 }
);
But getting same output in both of the above codes, that is unable to get the location specifically in Android Oreo 8.0.0. Even the location retrieving callback is not even called. Though in other versions, including Oreo 8.1.0, and lower version devices, including Marshmallow and Nougat, it seems working fine.
Though, if I turn on the fake GPS in Oreo 8.0.0, then it seems to be able to get the location. I am unable to figure out, what I am missing.
mention to google document:
In an effort to reduce power consumption, Android 8.0 (API level 26) limits how frequently background apps can retrieve the user's current location. Apps can receive location updates only a few times each hour.Background Location Limits
i have a big problem on my IOS app. I follow the guide provide by appcelerator documentation to setup my iOS push notification. All seemed work fine, on my appcelerator dashboard i see under the device section my device registered with its token, and when i send a push notification on the detail's push (in push notification log) i read my id device number with a perfect Success(1).
But on my device i didn't receive any notification. I tried with my app opened and with my app closed, but nothing has showed. I don't know why this happen. On my android all work fine. Here my code:
//PUSH NOTIFICATION
var Cloud = require("ti.cloud");
//controllo se ho un token
var deviceToken = Ti.App.Properties.getString("deviceToken");
if ( deviceToken == "" || deviceToken == null) {
requireToken();
} else {
if ( Ti.App.Properties.getString("subscribed") !== "true" ) {
subscribeToChannel(deviceToken);
}
}
//chiedo un token
function requireToken() {
// Check if the device is running iOS 8 or later
if (Ti.Platform.name == "iPhone OS" && parseInt(Ti.Platform.version.split(".")[0]) >= 8) {
Ti.API.warn( "entrato nella versione" )
// Wait for user settings to be registered before registering for push notifications
Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() {
// Remove event listener once registered for push notifications
Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush);
Ti.Network.registerForPushNotifications({
success: deviceTokenSuccess,
error: deviceTokenError,
callback: receivePush
});
});
// Register notification types to use
Ti.App.iOS.registerUserNotificationSettings({
types: [
Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,
Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,
Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE
]
});
}
// For iOS 7 and earlier
else {
Ti.Network.registerForPushNotifications({
// Specifies which notifications to receive
types: [
Ti.Network.NOTIFICATION_TYPE_BADGE,
Ti.Network.NOTIFICATION_TYPE_ALERT,
Ti.Network.NOTIFICATION_TYPE_SOUND
],
success: deviceTokenSuccess,
error: deviceTokenError,
callback: receivePush
});
}
function deviceTokenSuccess(e) {
Ti.API.warn( "token ricevuto" )
Ti.App.Properties.setString("deviceToken", e.deviceToken);
subscribeToChannel(e.deviceToken);
}
function deviceTokenError(e) {
//error action
}
}
//controllo se sono iscritto alle notifiche push
if ( Ti.App.Properties.getString("subscribed") !== "true" ) {
subscribeToChannel(deviceToken);
}
function subscribeToChannel (_deviceToken) {
Ti.API.warn( "subscribe fatta" )
Cloud.PushNotifications.subscribeToken({
device_token: _deviceToken,
channel: "ios_alerts",
type: Ti.Platform.name == 'android' ? 'android' : 'ios'
}, function (e) {
if (e.success) {
Ti.App.Properties.setString("subscribed", "true");
}
});
};
function receivePush(e) {
Ti.API.warn("alert ricevuto" + JSON.stringify(e) )
alert(e)
}
is probably something related to your certificates on Apple panel.
Check if you enabled APS with your appid and if not, activate it, then generate another provisioning profiles and re-build the app.
You will also have to put a .p12 file in the Appcelerator platform website.
Just in case this is your issue(s):
Device Token Cannot be fetched if on Device in Debug mode, must be in Run Mode!
Remember that under ad-hock releases push notifications MUST use the sandbox 'gateway.sandbox.push.apple.com'
Chris
Ref: https://archive.appcelerator.com/question/148135/no-reply-from-tinetworkregisterforpushnotifications
Establishing connection between couchbase server and couchbase sync gateway in Mac OS -
$ ../sync_gateway
==== Couchbase Sync Gateway/1.0.4(34;04138fd) ====
Configured Go to use all 2 CPUs; `setenv GOMAXPROCS` to override this
Opening db /sync_gateway as bucket "sync_gateway", pool "default", server <walrus:>
Opening Walrus database sync_gateway on <walrus:>
Using default sync function `'channel(doc.channels)'` for database "sync_gateway"
Starting profile server on
***Starting admin server on 127.0.0.1:4985
Starting server on :4984 ...***
I created a config.json file and trying to connect it to that sever but its not happening by default its going to 127.0.0.1:4985
Can anyone help me out??
Add the following config value to your config.json file:
"adminInterface":"[YOUR_PREFERRED_IP_FOR_ADMIN_INTERFACE]:4985",
The adminInterface field let's the sync_gateway know on which IP:PORT to run the admin interface on.
Also, you need to tell sync_gateway where to fire the rest APIs for a bucket (todos in the sample below). As shown in the example below you can do that by adding "server": "http://[COUCHBASE_SERVER_IP]:8091", in the config for the database.
So,
You will fire admin rest APIs on [YOUR_PREFERRED_IP_FOR_ADMIN_INTERFACE]:4985.
And, sync_gateway will fire rest apis for CRUD operations for the "todos" bucket on [COUCHBASE_SERVER_IP]:8091.
Here is sample config file:
{
"interface":"192.168.1.117:4984",
"adminInterface":"127.0.0.1:4985",
"log": ["CRUD", "REST+", "Access"],
"facebook": { "register": true },
"databases": {
"todos": {
"server": "http://[COUCHBASE_SERVER_IP]:8091",
"users": {
"GUEST": {"disabled": true}
},
"sync":
`
function(doc, oldDoc) {
// NOTE this function is the same across the iOS, Android, and PhoneGap versions.
if (doc.type == "task") {
if (!doc.list_id) {
throw({forbidden : "Items must have a list_id"})
}
channel("list-"+doc.list_id);
} else if (doc.type == "list") {
channel("list-"+doc._id);
if (!doc.owner) {
throw({forbidden : "List must have an owner"})
}
if (oldDoc) {
var oldOwnerName = oldDoc.owner.substring(oldDoc.owner.indexOf(":")+1);
requireUser(oldOwnerName)
}
var ownerName = doc.owner.substring(doc.owner.indexOf(":")+1);
access(ownerName, "list-"+doc._id);
if (Array.isArray(doc.members)) {
var memberNames = [];
for (var i = doc.members.length - 1; i >= 0; i--) {
memberNames.push(doc.members[i].substring(doc.members[i].indexOf(":")+1))
};
access(memberNames, "list-"+doc._id);
}
} else if (doc.type == "profile") {
channel("profiles");
var user = doc._id.substring(doc._id.indexOf(":")+1);
if (user !== doc.user_id) {
throw({forbidden : "Profile user_id must match docid : " + user + " : " + doc.user_id})
}
requireUser(user);
access(user, "profiles"); // TODO this should use roles
}
}
`
}
}
}
I have a log when user finnish payment.
I need to change app_id but i can't to find it.
This is my log
Here is your proof of payment:
{
client = {
environment = mock;
"paypal_sdk_version" = "1.0.5";
platform = iOS;
"product_name" = "PayPal iOS SDK";
};
payment = {
amount = "1.00";
"currency_code" = USD;
"short_description" = "Hipster t-shirt";
};
"proof_of_payment" = {
"adaptive_payment" = {
"app_id" = "APP-1234567890";
"pay_key" = "AP-70M68096ML426802W";
"payment_exec_status" = COMPLETED;
timestamp = "2013-07-05T02:20:57Z";
};
};
}
Send this to your server for confirmation and fulfillment.
#Lmstart, "APP-1234567890" is the app-id provided when you are running the PayPal iOS SDK in its "mock" environment, PayPalEnvironmentNoNetwork. If you switch to PayPalEnvironmentSandbox or PayPalEnvironmentProduction you should instead see an application ID corresponding to your app.