Native Script + Mobile Mind Plugins

Identificador: 11545
Autor: Ricardo Bocchi   segunda-feira, Dia 1 de maio de 2023, às 02:53:26 horas
Revisado Por:    terça-feira, Dia 6 de dezembro de 2016, às 14:29:53 horas
Visualização: Todos

Pontos: 0   Acessos: 5153

Configurações dos plugins:


NativeScript Google Maps

https://github.com/mobilemindtec/nativescript-google-maps-sdk

NativeScript Facebook

https://github.com/mobilemindtec/nativescript-facebook

NativeScript Google Plus (Google Login)

https://github.com/mobilemindtec/nativescript-google-plus

NativeScript Alartm Notifications (alarme e notificações)

https://github.com/mobilemindtec/nativescript-alarm-notification



Android



Em app/App_Resources/Android/app.gradle, dentro de defaultConfig, adicione:

applicationId = "br.com.mobilemind.myapp"

Em app/App_Resources/Android/AndroidManifest.xml  adicione:

    <activity        
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"
        android:label="@string/app_name" />

    <meta-data android:name="com.facebook.sdk.ApplicationId"
      android:value="@string/facebook_app_id"/>

    <meta-data android:name="com.google.android.geo.API_KEY"
      android:value="@string/nativescript_google_maps_api_key"/>

    <provider     
      tools:replace="android:authorities"
      android:authorities="${applicationId}.google_measurement_service"
      android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
      android:exported="false"/>

    <receiver
        android:name="br.com.mobilemind.nativescript.alarmnotification.BootstrapAlarmReceiver"     
        android:exported="true">
      <intent-filter>
          <action android:name="android.intent.action.BOOT_COMPLETED" />
          <action android:name="MY_APP_BOOTSTRAP_ALARM_RECEIVER" />
          <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </receiver>

    <receiver
        android:name="br.com.mobilemind.nativescript.alarmnotification.AlarmReceiver"
        android:exported="true">
      <intent-filter>
          <action android:name="MY_APP_ALARM_RECEIVER" />
          <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </receiver> 


Em app/App_Resources/Android/values/strings.xml  adicione:

    <string name="facebook_app_id">my facebook app id</string>   
    <string name="nativescript_google_maps_api_key">my google maps app id</string> 

    <!-- alarm manager plugin https://github.com/mobilemindtec/nativescript-alarm-notification -->

    <string  name="bootstrap_alarm_manager_query">select id, lembreteAt, title, 1000 * 60 * 60 from books where lembrete = 1 and delivered = 0</string>
    <string  name="bootstrap_alarm_manager_database_name">books.db</string>
    <string  name="bootstrap_alarm_manager_database_version">1</string>
    <string  name="bootstrap_alarm_manager_database_datetime_format">YYYY-MM-DD HH:mm:ss.SSS</string>
    <string  name="bootstrap_alarm_manager_notification_title">Devolução de livro</string>
    <string  name="bootstrap_alarm_manager_notification_text_normal">Não esqueça de devolver o livro %2$s</string>
    <string  name="bootstrap_alarm_manager_notification_text_atraso">O livro %2$s está com a devolução atrasada!</string>   
    <string  name="bootstrap_alarm_manager_notification_small_icon">icon</string>
    <string  name="bootstrap_alarm_manager_default_action">MY_APP_ALARM_RECEIVER</string>
    <!--
    <string  name="bootstrap_alarm_manager_notification_large_icon">icon</string>      
    -->
    <string  name="bootstrap_alarm_manager_notification_sound"></string>  


Em build.gradle adicione em buildScript > dependencies

classpath 'com.google.gms:google-services:3.0.0'