pythondjangoreact-nativeexpoexpo-notifications

how can i schedule expo notifications from python


react-native expo for application(android) and python[django] for backend , i have created an app and successfully sent notification from python to my app [i am using expo notifications for sending notifications] but i want to schedule them , its possible in react native directly but i want to do it from python for some other purpose. can someone help me with this

this is my code for generating notification

@api_view(['GET'])
def sendNotification(request):
  token = StoreToken.objects.all().last()
  print(token)
  if token == None:
      return Response({'detail':'something went wrong'}, status=status.HTTP_400_BAD_REQUEST) 
  
  message = {
    'to' :  token.token,
    'title' : 'hello',
    'body' : 'this is body'
  }
  return r.post('https://exp.host/--/api/v2/push/send', json = message)

Solution

  • i know this is not prefect way but this helped me and worked for me really well, may this work for you as well

    https://somehowitworked.dev/push-notifications-react-native-expo-django/

    this above written blog will help you to set up your code in expo and python and also will guide you through integration